import request from '@/utils/request'

// 查询项目合同列表
export function listDealContractSpo(query) {
  return request({
    url: '/contract/dealContractSpo/list',
    method: 'get',
    params: query
  })
}

export function getDealContractSpoSum(query) {
  return request({
    url: '/contract/dealContractSpo/getSum',
    method: 'get',
    params: query
  })
}

// 获取最早创建的合同信息
export function getFirstContract(dealId) {
  return request({
    url: '/contract/dealContractSpo/getFirstContract/' + dealId,
    method: 'get'
  })
}

// 验证当前投资金额是否超过了监控指数
/*
export function validInvestMonitor(query) {
  return request({
    url: '/contract/dealContractSpo/validInvestMonitor',
    method: 'get',
    params: query
  })
}
 */

// 查询项目合同详细
export function getDealContractSpo(id) {
  return request({
    url: '/contract/dealContractSpo/' + id,
    method: 'get'
  })
}

// 保存项目合同
export function saveDealContractSpo(data) {
  return request({
    url: '/contract/dealContractSpo/save',
    method: 'post',
    data: data
  })
}

// 删除项目合同
export function delDealContractSpo(id) {
  return request({
    url: '/contract/dealContractSpo/' + id,
    method: 'delete'
  })
}

// 导出项目合同
export function exportDealContractSpo(query) {
  return request({
    url: '/contract/dealContractSpo/export',
    method: 'get',
    params: query
  })
}

// 删除关键条款
export function delDealContractTerms(id) {
  return request({
    url: '/contract/dealContractSpo/terms/' + id,
    method: 'delete'
  })
}

// 删除投资主体
export function delDealContractInvestSpo(id) {
  return request({
    url: '/contract/dealContractSpo/invest/' + id,
    method: 'delete'
  })
}

// 获取默认的签约主体
export function findInvestMain(dealId) {
  return request({
    url: '/contract/dealContractSpo/findInvestMain/' + dealId,
    method: 'get'
  })
}

// 当前项目的所有已审核完成的合同(下拉)
export function selectContractByDealIdW(dealId) {
  return request({
    url: '/contract/dealContractSpo/selectContractByDealIdW/' + dealId,
    method: 'get'
  })
}

// 根据合同ID获取该合同的付款计划
export function getDealContractPlanSpoByMainId(id) {
  return request({
    url: '/contract/dealContractSpo/getDealContractPlanByMainId/' + id,
    method: 'get'
  })
}

// 根据合同ID获取流程ID
export function findActIdByContractSpoId(contractId) {
  return request({
    url: '/contract/dealContractSpo/findActIdByContractId/' + contractId,
    method: 'get'
  })
}

// 查询当前项目流程审批完成的项目合同
export function findByActStatusAndDealId(dealId) {
  return request({
    url: '/contract/dealContractSpo/findByActStatusAndDealId/' + dealId,
    method: 'get'
  })
}

// 分析报表-管理驾驶舱-新签合同
export function findNewContractSpo(query) {
  return request({
    url: '/contract/dealContractSpo/findNewContract',
    method: 'get',
    params: query
  })
}

// 根据合同ID获取该合同下签约主体
export function findMainBodyByContractSpoId(contractId) {
  return request({
    url: '/contract/dealContractSpo/findMainBodyByContractId/' + contractId,
    method: 'get'
  })
}

// 根据ID 查OA与项目中的合同的金额
export function queryOaAndDealContractSpoById(id) {
  return request({
    url: '/contract/dealContractSpo/queryOaAndDealContractById/' + id,
    method: 'get'
  })
}

// 变更合同
export function changeDealContractSpo(data) {
  return request({
    url: '/contract/dealContractSpo/change',
    method: 'post',
    data: data
  })
}

// 终止变更合同
export function terminationChange(id) {
  return request({
    url: '/contract/dealContractSpo/terminationChange/' + id,
    method: 'get'
  })
}

// 项目划款合同下拉. 包含变更合同
export function listDataContractSpoAndChange(id) {
  return request({
    url: '/contract/dealContractSpo/listDataContractAndChange/' + id,
    method: 'get'
  })
}

// 合同对比获取差异
export function contractComparisonDifferences(data) {
  return request({
    url: '/contract/dealContractSpo/contractComparisonDifferences',
    method: 'post',
    data: data
  })
}

// 获取历史合同 三种项目通用
export function historicalContractSpoList(id) {
  return request({
    url: '/contract/dealContractSpo/historicalContractList/' + id,
    method: 'get'
  })
}

export function historicalContractSpoForm(id) {
  return request({
    url: '/contract/dealContractSpo/historicalContractForm/' + id,
    method: 'get'
  })
}

export function getRelatedConvertibleBondContractSpo(dealId) {
  return request({
    url: '/contract/dealContractSpo/getRelatedConvertibleBondContract/' + dealId,
    method: 'get'
  })
}

export function fallback(id) {
  return request({
    url: '/contract/dealContractSpo/fallback/' + id,
    method: 'get'
  })
}

export function getDealBaseSpo(dealId) {
  return request({
    url: '/contract/dealContractSpo/getDealBaseSpoById/' + dealId,
    method: 'get'
  })
}
